
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<!DOCTYPE html>
<html lang="en" >
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="keywords" content="">
    <meta name="description" content="">
    <title text="代码自动生成"></title>
    <link rel="stylesheet" href="<%=request.getContextPath()%>/component/pear/css/pear.css">
</head>
<body class="pear-container">
<div class="layui-card">
    <div class="layui-card-body">
        <table id="file-table" lay-filter="file-table"></table>
    </div>
</div>
</body>

<script type="text/html" id="role-bar">
    <button class="pear-btn pear-btn-primary pear-btn-sm" lay-event="edit">
        <i class="layui-icon layui-icon-edit"></i>
    </button>
</script>

<script src="<%=request.getContextPath()%>/component/layui/layui.js"></script>
<script src="<%=request.getContextPath()%>/component/pear/pear.js"></script>
<script src="<%=request.getContextPath()%>/component/jquery.min.js"></script>
<script src="<%=request.getContextPath()%>/component/myCommon.js" charset="utf-8"></script>

<script>
    layui.use(['table', 'form', 'jquery'], function () {
        let table = layui.table;
        let form = layui.form;
        let $ = layui.jquery;
        let MODULE_PATH = "<%=request.getContextPath()%>/system/gen/";
        let cols = [
            [
                {title: '表名称', field: 'tableName'},
                {title: '数据引擎', field: 'engine'},
                {title: '备注', field: 'tableComment'},
                {title: '操作', toolbar: '#role-bar', align: 'center', width: 150}
            ]
        ]

        table.on('tool(file-table)', function (obj) {
            if (obj.event === 'edit') {
                window.edit(obj);
            }
        });

        table.render({
            elem: '#file-table',
            url: MODULE_PATH + 'tableList',
            page: false,
            cols: cols,
            method:'post',
            skin: 'line',
            height: 'full-148',
            toolbar: '#role-toolbar',
            defaultToolbar: [{
                layEvent: 'refresh',
                icon: 'layui-icon-refresh',
            }, 'filter', 'print', 'exports']
        });


        window.edit = function (obj) {
            admin_show('生成配置', MODULE_PATH+'tableInfo/'+obj.data.tableName);
        }

        window.refresh = function () {
            table.reload('file-table');
        }
    })
</script>
</html>